package com.mallcloud.mall.mall.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.mallcloud.mall.common.core.constant.enums.mall.PointsProductEnum;
import com.mallcloud.mall.common.core.util.ValidGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@ApiModel(value = "MallPointsProductViewModel", description = "积分商品视图")
@Data
@ToString
@TableName("V_CRM_ZPLIST")
public class MallPointsProductViewModel implements Serializable {
	private static final long serialVersionUID = 1L;

	@JsonSerialize(using = ToStringSerializer.class)
	@NotNull(message = "ID为空", groups = {ValidGroup.Update.class})
	@TableId(value = "ICCODE", type = IdType.ASSIGN_ID)
	@ApiModelProperty(value="商品编码，主键")
	private String id;

	@ApiModelProperty(value = "MIS商品名称")
	@TableField("ICNAME")
	private String name;

	@ApiModelProperty(value = "MIS积分分值")
	@TableField("ICINTEGRAL")
	private String points;

	@ApiModelProperty(value = "兑换金额（元）")
	@TableField("ICMONEY")
	private BigDecimal redeemMoney;

	/**
	 * {@link PointsProductEnum.RedeemTypeEnum}
	 */
	@ApiModelProperty(value = "兑换类型")
	@TableField("ICITYPE")
	private String redeemType;

	@ApiModelProperty(value = "商品图片组id")
	@TableField("ICIMAGEGROUPID")
	private String imageGroupId;

	/**
	 * {@link PointsProductEnum.ProductStatusEnum}
	 */
	@ApiModelProperty(value = "商品状态")
	@TableField("ICSTATUS")
	private String status;

	@ApiModelProperty(value = "商品发布时间")
	@TableField("ICDATETIME")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date releaseTime;

	@ApiModelProperty(value = "赠品剩余库存")
	@TableField("ZPSL")
	private Long giftSurplusStock;
}
